package mortal.game.resource
{
	import com.gengine.modules.*;
	import com.gengine.resource.*;
	import flash.utils.*;
	
	public class ModuleConfig extends Object
	{
		private var _map:Dictionary;
		private var _list:Array;
		private static var _instance:ModuleConfig;
		
		public function ModuleConfig()
		{
			this._map = new Dictionary();
			this._list = new Array();
			if (_instance != null)
			{
				throw new Error(" ModuleConfig 单例 ");
			}
			_instance = this;
			
		}
		
		private function write(param1:Object) : void
		{
			var _loc_2:ModuleInfo = null;
			var _loc_3:Object = null;
			for each (_loc_3 in param1)
			{
				
				_loc_2 = new ModuleInfo();
				_loc_2.url = _loc_3.url;
				_loc_2.name = _loc_3.name;
				_loc_2.isLoaded = _loc_3.isLoaded;
				_loc_2.isLoading = _loc_3.isLoading;
				_loc_2.error = _loc_3.error;
				_loc_2.module = _loc_3.module;
				this._map[_loc_2.name] = _loc_2;
				this._list.push(_loc_2);
			}
			
			ModuleManager.instance.loadModuleInfo(this._list);
		}
		
		public function init() : void
		{
			var _loc_1:* = ConfigManager.instance.getObjectByFileName("module.xml");
			this.write(_loc_1);
			
		}
		
		public function getInfoByName(param1:String) : ModuleInfo
		{
			return this._map[param1];
		}
		
		public static function get instance() : ModuleConfig
		{
			if (_instance == null)
			{
				_instance = new ModuleConfig;
			}
			return _instance;
		}
		
	}
}
